In recent years, as image sensors with small size and low power consumption have been developed, it becomes possible to have cameras built in mobile devices, such as mobile phones, and to instantly transmit an image photographed using the built-in camera via electronic mail. Such built-in cameras are given priority for small size, so that the resolution thereof is lower than that of general digital cameras.
Also, mobile phones in recent years have a function for connecting to the Internet. It is necessary to input URL using keys in order to connect to the Internet, and it takes effort to type a long URL using the keys of a mobile phone. Thus, attempts have been made by which URL is managed using a unique number and a printed barcode that corresponds to the number is read via a barcode reader, thereby eliminating an effort to input URL and improving usability for users. In such apparatuses, the barcode reader is required to be connected separately to the mobile phone.
Thus, mobile phones with built-in cameras are capable of using such services without separately preparing the barcode reader if a barcode can be recognized with respect to a barcode image inputted via the built-in camera.
However, the resolution of built-in cameras at present is lower than that of image sensors used for barcode readers, so that it is difficult to recognize a barcode in high precision.
Also, causes of the difficulty in recognizing a barcode include the fact that the widths of bars photographed in an input image are not constant. This is because the distance relationship between the barcode and the camera varies in each input. In scanners for close-up scans, it is always possible to input a barcode in a constant size, so that the widths of the bars can be predetermined. However, in a case where the barcode is photographed using a camera held in the hands, it is impossible to predetermine a fixed width for the bars.
A method for recognizing a barcode has been proposed by which the widths of bars are determined on the basis of a barcode image inputted via an image scanner. For example, in JP Patent Publication (Kokai) No. 6-325197 A (1994), the width of a bar is determined by counting the degree of the width of pixels in each scanning line. The following describes the principle for determining the width.
FIG. 19 shows the relationship between detection frequency and the width. As shown in FIG. 19, the detection frequency of widths with respect to a scanner line is extracted. Thus, a field of frequency with not less than a certain threshold value is detected as a valid width. In the example of FIG. 19, sections 1, 2, and 3 are valid widths. Further, two long sections among the valid widths are selected to be handled as the widths of bars. In this method, two types of widths, namely “thin” and “thick” widths, can be detected from the top two widths of high frequency. However, a low-resolution image has a problem that the intervals of frequency peaks become short and detection is unstable. Also, the method cannot be used for a barcode having a plurality of widths.
In a case where a barcode is photographed using a camera, a field of characters or design other than the barcode on the periphery of the barcode are included in an input image. Thus, it is necessary to extract a barcode field from the input image. In JP Patent Publication (Kokai) No. 9-16701 A (1997) (FIG. 19), the barcode field is extracted on condition that the intervals of bars are within a certain threshold value. This is effective for a system, such as a scanner, by which an input image can be obtained in a relatively stable manner. However, the widths of the bars have a wide variation due to the distance between the subject and the camera, since the barcode is inputted while the camera is held in the hands. This poses problems in that, in some cases, the barcode field cannot be extracted successfully with a fixed threshold value.
In order to resolve such problems, in JP Patent Publication (Kokai) No. 9-22437 A (1997), when a barcode field is extracted, patterns characteristic of barcodes are examined so as to try to improve extraction accuracy.
FIG. 18 shows an illustration of the constitution of a barcode. As shown in the figure, barcode 1 has left guard bars 2 (or start bars) characteristic of barcodes, center bars 3, and right guard bars 4 (or end bars). In this case, the left guard bars 2 are disposed at the start point (on the left) of the barcode 1. The left guard bars 2 has a pattern where a black bar and a white bar are alternately arranged and information of “101” (module representation) is set as start information of the barcode 1. The center bars 3 are disposed in the central position of the barcode 1. The center bars 3 has a pattern where a black bar and a white bar are alternately arranged and information of “01010” (module representation) is set as center information of the barcode 1. The right guard bars 4 are disposed at the end point of the barcode 1. The right guard bars 4 has a pattern where a black bar and a white bar are alternately arranged and information of “101” (module representation) is set as end information of the barcode 1.
Six-digit data characters 5 on the left are disposed between the left guard bars 2 and the center bars 3, and six-digit data characters 6 on the right and a check digit 7 are disposed between the center bars 3 and the right guard bars 4. A numerical value in the left end below the barcode 1 represents a prefix digit 8.
FIG. 20 shows a flow chart indicating the flow of a conventional barcode extraction process. First, a particular field where the intervals of bars are within a certain threshold value as mentioned above is extracted as a complex field (step 401). The complex field can be referred to as a field where a barcode is assumed to exist.
Next, the presence of the aforementioned center bars, the right guard bars, and the left guard bars is determined from the extracted complex field, and then whether the extracted complex field is a barcode is determined (steps 402 to 404). Then, each character of the barcode is recognized with respect to the field determined to be the barcode (step 405).
In this case, when determining the presence of the center bars, the right guard bars, and the left guard bars, the patterns of the module representation of the bar constitution are collated on the basis of the width of the extracted bars and a predetermined module width of bars. The module width is predetermined in accordance with the resolution of a scanner.
For example, in a case where a document is read with a scanner having a resolution of 200 dpi, one module is represented in four pixels, so that the module width is decided to be four pixels.
However, as mentioned above, the widths of the bars have a wide variation due to the distance between the subject and the camera, since the barcode is inputted while the camera is held in the hands. Thus, this poses problems in that the module width cannot be specified in advance.
Also, an image inputted using a low-resolution camera has a bar width of about two pixels. In a barcode such that four types of widths are used, no bars have completely the same width as the module width due to noises upon input, for example. Thus, by merely comparing the widths in a strict manner, thick bars can be erroneously recognized as thin. This poses problems in that collation cannot be made accurately.
In order to resolve such problems, in JP Patent Publication (Kokai) No. 4-263381 A (1992), when comparing the widths of bars in prescribed patterns with the widths of bars that are inputted, the bar widths are determined to be the same if the bar widths are within a range provided with a certain margin. For example, the condition such that a bar width a and a bar width b are the same is:1.25a≧b≧0.75a. However, in a case where the barcode is photographed using a low-resolution digital camera, the minimum width of the bars in the image is only about two pixels. In practice, the width of two pixels can be one pixel or three pixels depending on a margin of error in an input process. In this case, the fluctuation of the width is large, resulting in 50% of the actual width. If the width is thick, the width of four pixels can be five pixels or three pixels, in many cases. In this case, the range of fluctuation is 25% with respect to the actual width. This poses problems in that, when comparing the widths of all the bars as mentioned above, if the ranges of all the widths are decided to be the same, determination cannot be made accurately when the fluctuation relative to the bar widths is large, for example.